<?php 
namespace Admin\Model;
use Think\Model;

class OrderInfoModel extends Model{
		//查询总条数
	public function getCount($id)
	{
		$total=$this->table('goods g,goods_img gi,order_info oi ')
					->where("g.id=gi.goods_id
						   and 
						    oi.goods_id=g.id
						   and
						   	gi.is_cover=1
						   and
						   	oi.order_id=$id")
					->count();
					//echo $total;exit;
			return $total;
		}
		public function getAll($id,$limit)
		{
			$goods_list=$this->field('g.id 		  gid,g.name 		  gname,g.price 	  gp,g.description gd,g.addtime     gtime,gi.name 	  giname,oi.num 		  oinum')
							->table('goods 		  g,goods_img     gi,order_info	  oi')
							->where("g.id=gi.goods_id and oi.goods_id=g.id
							   	and
							   	 gi.is_cover=1
							   	and
							   	 oi.order_id=$id
								")
							->limit($limit)
							->select();
					//var_dump($goods_list);exit;
					return $goods_list;
		}

}
?>